 
 <template>
  <div class="osd-edit-box">
    <el-dialog title=""
               v-loading="loading"
               class="login-dialog"
               :show-close="false"
               :close-on-click-modal="false"
               :close-on-press-escape="false"
               width="100%"
               top="0vh"
               :visible.sync="dialogFormVisible">
      <temp-3 ref="editPage"
              :url="editUrl"
              :ic="editIc"
              :custom="custom"
              @setForm="setForm"
              @readCard="readCard"
              @customSentMqttMsg="customSentMqttMsg"
              @logout="close"></temp-3>
    </el-dialog>
  </div>
</template>

<script>
import { GSAConstants } from '@/utils/access'
import {
  log,
} from '@/utils/message'
import Temp3 from '@/views/card/core/Temp3'
export default {
  components: { Temp3 },
  name: "EditOsd",
  data () {
    return {
      loading: false,
      editUrl: GSAConstants().TOPIC_MANUAL_OSD_EDIT.url,
      editIc: GSAConstants().TOPIC_MANUAL_OSD_EDIT.ic,
      custom: {
        tips: '请输入相应的公司信息和司机信息',
        showReturnReceiptId: true,
        manTelRequire: false,
        colorDisable: true,
        keyDisable: true,
        resetButtonDisable: true,
        companyNameDisable: false,
        pccButtonDisable: true
      },
      dialogFormVisible: false
    }
  },
  created: function () {
    // this.$router.push({ path: "/card/index" })
    // this.$router.push('/pcc')

  },
  methods: {
    // 读卡
    readCard (type) {
      this.$emit('readCard', type)
    },
    // 执行请求
    customSentMqttMsg (url, message) {
      this.$emit('customSentMqttMsg', url, message)
    },
    doMethod (methodName, arg1, arg2) {
      this.$nextTick(() => {
        if (!this.$refs.editPage) {
          log('Edit Page Not Init')
          return
        }
        if (this.$refs.editPage[methodName]) {
          this.$refs.editPage[methodName](arg1, arg2)
          log('触发编辑页面方法')
        } else {
          log('EditOsd 没有找到子页面方法', methodName, arg1, arg2)
        }
      })
    },
    setForm (form) {
      this.$emit('setParentForm', form)
    },
    show (row) {
      if (row.tcCode && row.tcCode.trim() !== '') {
        this.custom.companyNameDisable = true
      } else {
        this.custom.companyNameDisable = false
      }
      this.dialogFormVisible = true
    },
    close () {
      this.dialogFormVisible = false
    }
  },
}
</script>

<style scoped>
.osd-edit-box >>> .el-dialog__header {
  padding: 0px;
}
.osd-edit-box >>> .el-dialog__body {
  padding: 3px;
}

.osd-edit-box >>> .el-dialog {
  margin-top: 0px;
}
</style>
